<template>
  <div class="exam-detail-page">
    <div class="exam-page">
      <nav2 ref="nav2"></nav2>
      <div class="exam-page__content">
        <div class="exam-container exam-test">
          <div class="exam-test-wrapper">
            <div class="exam-test-wrapper__title">
              <div class="icon"></div>
              <div class="text f14">Test sound</div>
            </div>
            <div class="exam-test-wrapper__content">
              <div class="line">
                <span class="f14">Put on your headphones and click the</span>
                <span class="blod f14">Play sound</span>
                <span class="f14">button to play a sample sound.</span>
              </div>
              <div class="exam-button default play" @click="playAudio" v-if="!play">Play sound</div>
              <div class="exam-button default play" @click="pauseAudio" v-else>Pause sound</div>
              <div class="tips">
                <div class="icon"></div>
                <div class="text f14">if you can not hear the sound clearly, please tell the invigilator</div>
              </div>
              <div class="exam-button default next" @click="listenDetail">Continue</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import nav2 from '../components/nav2.vue'
  export default {
    data() {
      return {
        play: false
      }
    },
    components: {
      nav2
    },
    methods: {
      playAudio() {
        this.$refs.nav2.playAudio();
        this.play = true;
      },
      pauseAudio() {
        this.$refs.nav2.pauseAudio();
        this.play = false;
      },
      listenDetail() {
        this.pauseAudio();
        this.$router.push('/listenDetail');
      },
    }
  }

</script>

<style lang="less" scoped>
  .exam-detail-page {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;

    .exam-page,
    .exam-page__content {
      display: flex;
      flex-direction: column;
      position: relative;
    }

    .exam-page {
      justify-content: flex-start;
      min-width: 1080px;
      max-width: 100%;
      height: 100%;
      overflow: hidden;
      background: #dee5f5;
    }

    .exam-page__content {
      justify-content: space-between;
      width: 100%;
      height: 96%;
    }

    div.exam-test {
      padding-top: 10%;
      justify-content: flex-start;
    }

    .exam-container {
      width: 100%;
      height: 100%;
      padding-top: 1.19792rem;
      padding-bottom: 12px;
      font-family: Arial;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
      position: relative;
      overflow-y: auto;
    }

    .exam-test-wrapper,
    .exam-test-wrapper__title {
      display: flex;
      -webkit-box-direction: normal;
    }

    .exam-test-wrapper {
      flex-direction: column;
      align-items: flex-start;
      justify-content: center;
      width: 58.33333rem;
      height: 18.22917rem;
      min-height: 18.22917rem !important;
    }

    .exam-test-wrapper__title {
      flex-direction: row;
      height: 48px;

      .icon {
        width: 48px;
        height: 48px;
        vertical-align: middle;
        background: url('../assets/img-headset.836ac93c.png') 50% no-repeat;
        background-size: 100% 100%;
      }

      .text {
        margin-left: .20833rem;
        height: 48px;
        line-height: 48px;
        font-weight: 700;
        color: #000;
        vertical-align: middle;
      }
    }

    .icon {
      display: inline-block;
    }

    .f14 {
      font-size: 14px;
    }

    .f14,
    .f16 {
      height: 24px;
      line-height: 24px;
    }

    .exam-test-wrapper__content {
      display: flex;
      flex-direction: column;
      margin-top: .52083rem;
      width: 58.33333rem;
      border: 1px solid #fff;
      border-radius: 8px;
      position: relative;
    }

    .line {
      margin: 1.04167rem 0 0 1.82292rem;
      color: #000;

      .blod {
        font-weight: 700;
        margin: 0 .26042rem;
      }
    }

    .exam-button {
      width: 9.89583rem;
      align-self: center;
      margin: 1.61458rem 0 1.04167rem 0;

      .play {
        width: 6.66667rem;
      }
    }

    .exam-button.default {
      box-shadow: 0 2px 3px 0 #707070;
      color: #333;
      background: #dee5f5;
      border: 3px solid transparent;
      border-radius: 4px;
    }

    .exam-button.default:active {
      background: #2464c5;
      border: 3px solid #95bef9;
      color: #fff;
    }

    .exam-button {
      height: 1.97917rem;
      line-height: 1.97917rem;
      border-radius: 4px;
      vertical-align: middle;
      text-align: center;
      font-size: 13px;
      font-weight: 700;
      cursor: pointer;
    }

    .play {
      outline: none;
      border: none;
      width: 32px;
      height: 32px;
      background: url() no-repeat;
      cursor: pointer;
      border-radius: 50%;
      display: inline-block;
    }

    .tips {
      width: 100%;
      margin: 1.19792rem 0 0 1.04167rem;
      display: flex;
      flex-direction: row;
      align-items: center;

      .icon {
        margin-right: .52083rem;
        width: .83333rem;
        height: .83333rem;
        background: url() 50% no-repeat;
        background-size: 100% 100%;
      }

      .text {
        font-family: Arial;
        color: #000;
      }
    }

    .exam-button.next {
      width: 5.41667rem;
    }

    .exam-button {
      width: 9.89583rem;
      align-self: center;
      margin: 1.61458rem 0 1.04167rem 0;
    }
  }

</style>
